#ifndef CONFIGS_H
#define CONFIGS_H

#include "main.h"
#include "stdbool.h"
#include "icm_imu_driver.h"
#include "bsp_usart.h"


#define STR(a) #a
#define CAT(a,b) a##b
#define not !
#define and &&
#define or ||


/********Core define*********/

typedef enum{
		CORE_PARAM_WAIT_INIT,
		CORE_RUN
}Core_Step;

extern Core_Step core_step;
extern uint16_t Main_time_ms_cnt;
void reset_dart(void);
/********Core define*********/


/********Led define*********/

#define Led_Port_Cast(x) Led_Port_Cast_Impl(x)
#define Led_Port_Cast_Impl(x) x##_GPIO_Port

#define Led_Pin_Cast(x) Led_Pin_Cast_Impl(x)
#define Led_Pin_Cast_Impl(x) x##_Pin

#define LED_Right LED0
#define LED_Left LED1

typedef enum{
	LED_BRIGHT,
	LED_EXTINGUISH,
	LED_FLASHING
}Led_State;

typedef struct{
	Led_State led_left_state;
	bool led_left_init_state;
	uint16_t led_left_freq;
	uint16_t led_left_toggle_time;
	
	Led_State led_right_state;
	bool led_right_init_state;
	uint16_t led_right_freq;
	uint16_t led_right_toggle_time;
}Led_config;

extern Led_config led_config;

/********Led define*********/


/******Log File System*****/
extern uint16_t now_normal_log_id;
extern uint16_t now_flight_log_id;
/******Log File System*****/

/*****Imu define**********/
typedef struct{
	float pitch;
	float roll;
	float yaw;
}Imu_Angle;

typedef struct{
	Imu_Angle imu_angle;
	float accels[3];
	float gyros[3];
	bool ahrs_init;
	bool imu_state[2];
	uint8_t imu_num;
}Dart_attitude;

extern Dart_attitude dart_attitude;
/*****Imu define**********/


/*****Usart define*********/

/*****Usart define*********/

#endif
